package com.team.employment.web.admin.controller.company;

import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.team.employment.common.result.Result;
import com.team.employment.model.entity.CompanyInfo;
import com.team.employment.model.enums.CompanyStatus;
import com.team.employment.web.admin.service.CompanyInfoService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Tag(name = "企业状态管理")
@RestController
@RequestMapping("/admin/companyState")
public class CompanyStateController {

    @Autowired
    private CompanyInfoService companyInfoService;

    @Operation(summary = "根据company_id和CompanyStatus更新企业状态")
    @PutMapping("updateStatus")
    public Result updateInfo(@RequestParam Long id, @RequestParam CompanyStatus companyStatus){
        LambdaUpdateWrapper<CompanyInfo> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
        lambdaUpdateWrapper.eq(CompanyInfo::getId,id).set(CompanyInfo::getCompanyStatus,companyStatus);
        companyInfoService.update(lambdaUpdateWrapper);
        return Result.ok();
    }

}
